<?php

namespace Admin\Controller;

//use Think\Controller;

class NewsController extends ExtendController {

    //显示栏目
    public function index(){
     $list = D('Zutu')->order('createtime DESC')->select();
       $this->assign('list',$list);
        $this->display(); // 输出模板
    }
   
   public function add(){
    $data['zutu_name']=$_POST['title'];
    $data['createtime'] = date('Y-m-d H:i:s');

     $result = D('Zutu')->add($data);
            if ($result != false) {
            $this->redirect('News/index');
        } else {
            $this->error('删除失败!');
        }

   }
    //删除
    public function delete() {
        $imagesModel = M('Zutu');
        $map['zutu_id'] = $_GET['id'];
        $result = $imagesModel->where($map)->delete();
        if ($result != false) {
            $this->redirect('News/index');
        } else {
            $this->error('删除失败!');
        }
    }
}